#!/bin/bash

read -p "用户名：" username
read -p "密码：" password
io=$(mysql -u${username} -p${password} -e "show slave status\G;" 2>/dev/null | grep Slave_IO_Running: | awk '{print $2}')
sql=$(mysql -u${username} -p${password} -e "show slave status\G;" 2>/dev/null | grep Slave_SQL_Running: | awk '{print $2}') 

if [ "$io" == "Yes" ]; then
	echo "IO:1"
else
	echo "IO:0"
fi

if [ "$sql" == "Yes" ]; then
	echo "SQL:1"
else
	echo "SQL:0"
fi

